var myNewAjax = function (url) {
  return new Promise(function (resolve, reject) {
    var xhr = new XMLHttpRequest();
    xhr.open('post', url);
    xhr.setRequestHeader("Authorization", "Bearer 3b0cf2e2-67dd-4e5a-96c4-d0949c3ae0d8");
    xhr.send({});
    xhr.onreadystatechange = function () {
      if (xhr.status == 200 && xhr.readyState == 4) {
        var json = JSON.parse(xhr.responseText);
        resolve(json)
      }
      else if (xhr.readyState == 4 && xhr.status != 200) {
        reject('error');
      }
    }
  })
}

myNewAjax("http://10.200.8.107:8081/waterQuality/pages/getDiviAndWrz").then(res => {
  console.log(res);
}).catch(err => {
  console.log(err)
})